package com.springcloud.sc.ucpv5.client.module.setting;

public class SettingManager {

	public static class LOGIN {
		public static boolean LoginSystem() {
			return SettingDataManager.getInstance().getBooleanValue(SettingConstant.LOGIN.NAME, SettingConstant.LOGIN.LoginSystem, false);
		}

		public static String LoginUser() {
			return SettingDataManager.getInstance().getStringValue(SettingConstant.LOGIN.NAME, SettingConstant.LOGIN.LoginUser, "");
		}

		public static String LoginPassword() {
			return SettingDataManager.getInstance().getStringValue(SettingConstant.LOGIN.NAME, SettingConstant.LOGIN.LoginPassword, "");
		}

		public static String ServerIp() {
			return SettingDataManager.getInstance().getStringValue(SettingConstant.LOGIN.NAME, SettingConstant.LOGIN.ServerIp, "");
		}

		public static int ServerPort() {
			// 连接4.0 的服务器, 利用vtcp协议默认端口是9778, 配置是失效的, v5的连接使用9777, 是可配置的
			return SettingDataManager.getInstance().getIntegerValue(SettingConstant.LOGIN.NAME, SettingConstant.LOGIN.ServerPort, 9777);
		}
	}

	public static class SYS {
	public static int getType() {
	    try {
		Integer type = SettingDataManager.getInstance().getIntegerValue(SettingConstant.SYS.NAME, SettingConstant.SYS.type, 1);
		return type;
	    } catch (Exception e) {
		// TODO: handle exception
	    }
	    return -1;
	}
	public static boolean ServerVerType_V4_Old() {
	    int ServerVerType = SettingDataManager.getInstance().getIntegerValue(SettingConstant.SYS.NAME, SettingConstant.SYS.ServerVerType, -1);
	    return ServerVerType == 0;
	}

		public static boolean ServerVerType_V4() {
			int ServerVerType = SettingDataManager.getInstance().getIntegerValue(SettingConstant.SYS.NAME, SettingConstant.SYS.ServerVerType, -1);
	    return ServerVerType == 1 || ServerVerType == 0;
		}

		public static boolean ServerVerType_V5() {
			int ServerVerType = SettingDataManager.getInstance().getIntegerValue(SettingConstant.SYS.NAME, SettingConstant.SYS.ServerVerType, -1);
			return ServerVerType == 2;
		}

	
	public static boolean login_md5_support() {
	    return SettingDataManager.getInstance().getBooleanValue(SettingConstant.SYS.NAME, SettingConstant.SYS.login_md5_support, false);
	}

		public static String DefaultVersionFlag() {
			return "DCS_UCP_FOR_IDL_V3.0"; //$NON-NLS-1$
		}
	}
    public static class SYS_TYPE {
	// 新疆独山子石化版本
	public static boolean isXinJiangDuShanZi() {
	    if(SYS.getType() != SettingConstant.SYS_TYPE.Type_60) {
		return false;
	    }
	    
	    return true;
	}
	

	public static boolean 人保版本() {
	    return false;
	}
    }
}
